<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport( 'joomla.application.component.model' );

class Mwc_EmployeeModelMwc_Employee extends JModel {
	
	function getOrganization($limit, $limitstart, $filter) {        
        $query = 'SELECT * FROM #__mwc_employee';
        if($filter != ''){
            $query .= ' WHERE dep_id = ' . $filter;
        }        
        $rows = $this->_getList($query, $limitstart, $limit);
        
        return $rows;
    }
    
    function getBoard($limit, $limitstart) {                
        $query = 'SELECT * FROM #__mwc_employee_board';        
        $rows = $this->_getList($query, $limitstart, $limit);
        
        return $rows;
    }
    
    function getOrgTotal($filter){
        $query = 'SELECT COUNT(*) FROM #__mwc_employee';
        if($filter != ''){
            $query .= ' WHERE dep_id = ' . $filter;
        }
        $this->_db->setQuery($query);                 
        $total = $this->_db->loadResult();
        
        return $total;
    }
    
    function getBoardTotal(){
        $query = 'SELECT COUNT(*) FROM #__mwc_employee_board';
        $this->_db->setQuery($query);                 
        $total = $this->_db->loadResult();
        
        return $total;
    }
}
